#pragma once

#include "MTVector.h"
#include "MTMatrix.h"

namespace matsu
{
	template <typename T>
	class Quaternion {
	public:
		T x;
		T y;
		T z;
		T w;

		Quaternion();
		Quaternion(T x, T y, T z, T w);

		Quaternion<T> slerp(T mu, const Quaternion<T>& q) const;
		Quaternion<T> rotated(const Quaternion<T>& b) const;
		Quaternion<T> scaled(T scale) const;
		T dot(const Quaternion<T>& q) const;
		Matrix3<T> toMatrix() const;
		Vector4<T> toVector() const;
		Quaternion<T> operator-(const Quaternion<T>& q) const;
		Quaternion<T> operator+(const Quaternion<T>& q) const;
		bool operator==(const Quaternion<T>& q) const;
		bool operator!=(const Quaternion<T>& q) const;

		void normalize();
		void rotate(const Quaternion<T>& q);

		static Quaternion<T> createFromVectors(const Vector3<T>& v0, const Vector3<T>& v1);
		static Quaternion<T> createFromAxisAngle(const Vector3<T>& axis, float radians);
	};

	//typedef
	typedef Quaternion<float> quat;
}

#include "MTQuaternion.hpp"
